package com.threefish.common.runner;

import org.nutz.dao.Dao;
import org.nutz.dao.util.Daos;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author 黄川 huchuc@vip.qq.com
 * @date: 2018/9/6
 */
@Component
@Order(value = 1)
public class CreateTableRunner implements ApplicationRunner {

    private static final Logger log = LoggerFactory.getLogger(CreateTableRunner.class);

    @Autowired
    Dao dao;

    @Override
    public void run(ApplicationArguments args) {
        log.debug("开始创建表");
        Daos.createTablesInPackage(dao, "com.threefish.modules", false);
        log.debug("表创建完成");
    }

}
